#pragma once
#include <functional>
#include <optional>
#include <mutex>
#include <Windows.h>


class IDXGISwapChain;

namespace titanfall2
{
    class CUserCmd;
    class Context
    {
        friend bool __fastcall HookedCreateMove(__int64 ThisPtr, float a2, titanfall2::CUserCmd* cmd, unsigned __int8 a4);
        friend HRESULT __fastcall hPresent(IDXGISwapChain* pSwapChain, uint32_t SyncInterval, uint32_t Flags);

    public:
        [[nodiscard]]
        static Context& Get();
        Context(const Context& other) = delete;
        void SetOnCreateMove(const std::function<void(titanfall2::CUserCmd* cmd)>& funct);
    private:
        std::mutex createMoveMutex;
        std::optional<std::function<void(titanfall2::CUserCmd* cmd)>> m_onCreateMovePayload;

        std::mutex presentMutex;
        std::optional<std::function<void(IDXGISwapChain* chain)>> m_onSwapChainPresent;

        Context(/* args */);
        ~Context();
    };
    
}